/*
    Linear Programming Library
    
    Created by Team Paragon (Shena Hoffmann, Arthur Powalka, Nasir Kenarangui)
    CSCE 689
    
    LinProg.h
    Header file containing declarations for the LinProg class for storing and maintaining linear 
    programming problems. Additionally, contains methods for conversion to different linear programming 
    formats and  multiple algorithms for solving linear programs.
*/

#ifndef LinProg_H   //ensure that LinProg is only included once
#define LinProg_H

#include <string>
#include <iostream>
#include <vector>
#include <regex>
#include "Exceptions.h"
using namespace std;

class LinProg
{
protected:
    // --------- CLASS VARIABLES ---------
    bool max; //true = maximize, false = minimize
    vector<double> objective; //i.e. C
    vector<vector<double>> constraints;    //i.e. A
    vector<string> inequalitySigns;    //contains the inequality operator within the subject equation, i.e. <, >, <=, >=, =
    vector<double> inequalityVals;  //i.e. b
    vector<bool> constrainedVars;
    
public:
    // --------- CONSTRUCTORS ---------
    LinProg();  //create an empty LinProg
    LinProg(const LinProg& lp);    //copy constructor
    LinProg(bool max, vector<double> objective, vector<vector<double>> constraints, vector<string> inequalitySigns, vector<double> inequalityVals, vector<bool> constrainedVars);
    
    // --------- DESTRUCTORS ---------
    ~LinProg();
    
    // --------- RETRIEVAL FUNCTIONS ---------
    bool isMaximum();
    vector<double> getObjective();
    vector<vector<double>> getConstraints();
    vector<string> getInequalitySigns();
    vector<double> getInequalityVals();
    vector<bool> getConstrainedVars();
    
    // --------- MODIFIER FUNCTIONS ---------
    void setMaximum(bool isMax);
    void setObjective(vector<double> newObjective);
    void setConstraints(vector<vector<double>> newConstraints);
    void setInequalitySigns(vector<string> newInequalitySigns);
    void setInequalityVals(vector<double> newInequalityVals);
    void setConstrainedVars(vector<bool> newConstrainedVars);
    
    // --------- INFORMATIVE FUNCTIONS ---------
    bool isStandardForm();
    bool isDualForm();
    bool verifyLinProg();
    
    // --------- LINEAR PROGRAM CONVERSION FUNCTIONS ---------
    LinProg convertToStandardForm();
    LinProg convertToDualForm();
    
    // --------- PRINTING FUNCTIONS ---------
    void printLinProg();
    
    // --------- OVERLOADED OPERATORS ---------
    bool operator==(const LinProg &other) const;
    bool operator!=(const LinProg &other) const;
};
#endif
